<?php

namespace App\Http\Rpc;

use App\Libs\Commons\MyMessage;

class BaseRpc
{

	public function success($data = [])
	{
		return [
			'code' =>  MyMessage::SUCCESS,
			'msg' => MyMessage::getMessage(MyMessage::SUCCESS),
			'data' => $data ?? [],
		];
	}

	public function fail($code = '', $msg = '')
	{
		return [
			'code' => $code ? $code : MyMessage::ERROR,
			'msg' => $msg ? $msg : MyMessage::getMessage($code),
			'data' => [],
		];
	}
}